package com.jinkaimen.goodcash.ui.activity;

import android.os.Bundle;
import android.view.View;

import com.ht.baselibs.bean.OperatorBean;
import com.ht.baselibs.ui.base.BaseOperatorActivity;
import com.ht.baselibs.utils.ActivityUtils;
import com.ht.baselibs.utils.SharedPreferencesUtils;
import com.jinkaimen.goodcash.R;
import com.jinkaimen.goodcash.constant.ConstantPool;
import com.jinkaimen.goodcash.ui.dialog.TipsDialog;

/**
 * **************************************************************
 * [好刷刷]
 * **************************************************************
 * Authors: 黄涛 on 17/2/21 17:41
 * QQ：876046815
 * Email:876046815@qq.com
 */
public class ReportMainActivity extends BaseOperatorActivity {
    private TipsDialog mTipsDialog;

    @Override
    protected View getHeaderView() {
        return null;
    }

    @Override
    protected void initTitleBar() {
        mTitleBarView.setTitleText("首页").setLeftBtnVisibility(View.GONE);
    }

    @Override
    protected void loadData() {
        add(true, R.mipmap.sign_self_frag, "添加报单", new OperatorBean.OnItemClickListener() {
            @Override
            public void onClick(boolean isChecked) {
                ActivityUtils.startActivity(ReportMainActivity.this, RegisterActivity.class);
            }
        });

        add(true, R.mipmap.sign_self_frag, "已通过商户", new OperatorBean.OnItemClickListener() {
            @Override
            public void onClick(boolean isChecked) {
                ActivityUtils.startActivity(ReportMainActivity.this, PassShoperManagerActivity.class);
            }
        });

        add(true, R.mipmap.sign_self_frag, "商户管理", new OperatorBean.OnItemClickListener() {
            @Override
            public void onClick(boolean isChecked) {
                ActivityUtils.startActivity(ReportMainActivity.this, ShoperManagerActivity.class);
            }
        });

        add(true, R.mipmap.sign_self_frag, "下载客户端", new OperatorBean.OnItemClickListener() {
            @Override
            public void onClick(boolean isChecked) {
                ActivityUtils.startActivity(ReportMainActivity.this, QrDownLoadActivity.class);
            }
        });
//        add(true, R.mipmap.sign_self_frag, "测试页面", new OperatorBean.OnItemClickListener() {
//            @Override
//            public void onClick(boolean isChecked) {
//                ActivityUtils.startActivity(ReportMainActivity.this, QrDownLoadActivity.class);
//            }
//        });


        add(true, R.mipmap.setting_self_frag, "退出登陆", new OperatorBean.OnItemClickListener() {
            @Override
            public void onClick(boolean isChecked) {
                mTipsDialog = new TipsDialog(ReportMainActivity.this);
                mTipsDialog.setContent("是否退出登录");
                mTipsDialog.show();
                mTipsDialog.setOnDialogTipsClickListener(new TipsDialog.OnDialogTipsClickListener() {

                    @Override
                    public void doEnter() {
                        mTipsDialog.dismiss();
                        SharedPreferencesUtils.put(ConstantPool.REPORT_ACCOUT_ID, (long) 0);
                        ActivityUtils.startActivityAndFinish(ReportMainActivity.this, LoginActivity.class);
                    }

                    @Override
                    public void doCancel() {
                        mTipsDialog.dismiss();
                    }
                });
            }
        });
    }
}
